home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / utils / file / managers / mc-3.2 / mc-3 / mc-3.2.1 / src / gindex.pl < prev    next >
Encoding:
Perl Script  |  1996-05-17  |  677 b   |  27 lines

  1. #!/usr/local/bin/perl
  2. # Since we use a linear search trought the block and the license and
  3. # the warranty are quite big, we leave them at the end of the help file,
  4. # the index will be consulted quite frequently, so we put it at the beginning. 
  5.  
  6. @help_file = <>;
  7.  
  8. foreach $line (@help_file){
  9.     if ($line =~ /\x4\[(.*)\]/ && $line !~ /\x4\[main\]/){
  10.     $nodes[$node_count++] = $1;
  11.     $line =~ s/(\x4\[) */$1/;
  12.     }
  13. }
  14.  
  15. print "\x4[Contents]\nTopics:\n\n";
  16. foreach $node (@nodes){
  17.     if (length $node){
  18.     $node =~ m/^( *)(.*)$/;
  19.     printf ("  %s\x1 %s \x2%s\x3", $1, $2, $2);
  20.     }
  21.     print "\n";
  22. }
  23. #foreach $line (@help_file){
  24. #    $line =~ s/%NEW_NODE%/\004/g;
  25. #}
  26. print @help_file;
  27.